-
Notifications
You must be signed in to change notification settings - Fork 25.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial jsaction README #55521
Initial jsaction README #55521
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add a link to EBNF for folks who aren't familiar.
- In the example, it'll help to explicitly call out what is the binding, event-type, event-handler. So users can immediately map it into the EBNF they just read.
- Actual plain HTML demo is a good idea!
9d705d2
to
59c58f8
Compare
I didn't end up writing a demo server since I'd need to set up some compilation for the jsaction TS files to use them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also want to document MOUSE_SPECIAL and a11y click, potentially
registration of event listeners from the JavaScript code for the listeners | ||
themselves. This enables capturing user interactions before the application is | ||
bootstrapped or hydrated as well as very fine grained lazy loading of event | ||
handling code. It is primarily intended to use as part of a larger framework, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"It is typically used as a sub-component of a larger framework, rather than as a stand-alone library."
|
||
## How it works | ||
|
||
The traditional way of adding an event handler is to obtain a reference to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The traditional way of adding an event handler is to obtain a reference to the | |
The traditional way of adding an event listener is to obtain a reference to the |
## How it works | ||
|
||
The traditional way of adding an event handler is to obtain a reference to the | ||
node and add the event handler to it via `.addEventListener` (or `.onclick`-like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node and add the event handler to it via `.addEventListener` (or `.onclick`-like | |
node and call `.addEventListener` (or `.onclick`-like |
<!-- | ||
There's a window of time between when the button is rendered and the | ||
script below reaches the client, either because there's a lot of content | ||
streamed in-between or network lag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
streamed in-between or network lag. | |
streamed in-between, network lag, or the script is asynchronously via a follow-up network request rather than as part of the main document content. |
``` | ||
|
||
A small inline script is added before any application content which registers | ||
global event handlers for all event types that the application listens to. Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
global event handlers for all event types that the application listens to. Any | |
global event handlers for event types that could be delegated. Any |
### 4. Register your application with JSAction | ||
|
||
Finally, once your application is bootstrapped and ready to handle events, | ||
you'll need to create a Dispatcher and register it with the dormant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"dormant" feels like the wrong adjective, but I think we don't need a qualifier just say "with the EventContract
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rahatarmanahmed looks great 👍
TESTED=docs only. No TGP needed. |
This PR was merged into the repository by commit cda8bfa. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information